home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / July 96 / Feedback on Overriding FW_CBitm < prev    next >
Encoding:
Internet Message Format  |  1996-08-01  |  2.1 KB  |  [TEXT/ttxt]

  1. Subject:     Feedback on Overriding FW_CBitmapShape
  2. Sent:        7/17/96 2:43 AM
  3. Received:    7/17/96 9:00 AM
  4. From:        Hutchings, Richard B. "Brad", brad@hutchings-software.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Just some general feedback...
  9.  
  10. The project for this evening was overriding FW_CBitmapShape to do masked
  11. copy. 
  12. The idea is that I want non-white pixels in the bitmap transferred to the
  13. canvas without changing their color, but want the canvas bits to remain
  14. unchanged where there are white bitmap pixels. None of the standard
  15. transfer modes achieve this. Awhile back, probably before R1, the comment
  16. was made that we (ODF users) had access to all of the internal structures,
  17. so I could theoretically just get the pixelmap and deal with it. Not quite.
  18.  
  19. Basically, the Mac implementation for this could have boiled down to adding
  20. 1 line of code in FW_PrivRenderBitmap, BUT I figured those files start with
  21. "PR" because it wasn't a good idea for me to mess with them.
  22.  
  23. So, I subclassed FW_CBitmapShape, copying most of FW_PrivRenderBitmap to
  24. the Render method and substituting the CopyBits line:
  25.  
  26.     /*
  27.     ::CopyBits((BitMap*)*pmh, &FW_QDGlobals.thePort->portBits, 
  28.                 &plfmSrcRect, &plfmDstRect, 
  29.                 ink->GetTransferMode(), NULL);
  30.     */
  31.     ::CopyMask((BitMap*)*pmh, (BitMap*)*pmh,
  32.                 &FW_QDGlobals.thePort->portBits,
  33.                 &plfmSrcRect, &plfmSrcRect, &plfmDstRect);
  34.  
  35. It actually yields the desired results even though pmh is a pixmap. I still
  36. can't quite figure out how to filter the source image through a gray (or
  37. any other) pattern though.
  38.  
  39. One problem I ran into is that the functions in the "PR" files aren't
  40. exported in the OS Library, so I had to add 3 "PR" files to my project.
  41.  
  42. My conclusion from my current part editor project is that the ODF drawing
  43. model is great for basic shapes, fairly good for text, and not too good for
  44. bitmaps.
  45.  
  46. Brad
  47.  
  48. <mailto: "Brad Hutchings" brad@hutchings-software.com>
  49. <http://www.hutchings-software.com>
  50.  
  51. Ask me about:
  52.     Hutchings Software's Rapid-I(tm) Button
  53.     Hutchings Software's Essential Strips(tm)
  54.  
  55.  
  56.